package com.umfwechat.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.sun.org.apache.bcel.internal.generic.NEW;
import com.umpay.util.StringUtil;

public class GetWxAndLmf {

	public static void main(String[] args) {

			String umpCate="2402";
			List<String> transResult = getTransResult(umpCate);
			if(transResult==null){//行业类目没有找到
				System.out.println(umpCate+"没有找到对应行业类目");
			}else{
				System.out.println(umpCate+"：对应支付宝："+transResult.get(0)+"  对应微信:"+transResult.get(1));
			}

		}
		/**
		 * desc:将联动的行业类目转为微信和支付宝标准的行业类目编码
		 * 
		 * @param umpCategoryCode
		 *            格式为纯数字， 联动统一的行业类目仅支持 二级 如2400和三级240012
		 * 
		 * @return result.get(0)=支付宝行业类目 result.get(1)=微信行业类目
			结果为空时说明传入的行业类目不是4位或者6位 或者没有找到对应类目
			
		 */
		public  static List<String> getTransResult(String umpCategoryCode) {
			List<String> result = new ArrayList<String>(2);
			if(umpCategoryCode == null ||(umpCategoryCode.length()!=4&&umpCategoryCode.length()!=6)) {
				return null;
			}
			String string = categroyMap.get(umpCategoryCode);
			if(StringUtil.isEmpty(string)){
				System.out.println("没有找到对应行业类目");
				return null;
			}else{
				String[] split = string.split("\\|");
				result.add(split[0]);
				result.add(split[1]);
				return result;
			}
//			String firstCate, secondCate, thirdCate;
//			if (umpCategoryCode.length() == 4) {
//				firstCate = umpCategoryCode.substring(0, 2);
//				secondCate = umpCategoryCode.substring(2, 4);
//			} else if (umpCategoryCode.length() == 6) {
//				firstCate = umpCategoryCode.substring(0, 2);
//				secondCate = umpCategoryCode.substring(2, 4);
//				thirdCate = umpCategoryCode.substring(4, 6);
//			} else {// 传入参数不对
//				return result;
//			}


		}
		public static final Map<String, String> categroyMap = new HashMap<String, String>();

		static {
			categroyMap.put("240000", "2015050700000010|153");
			categroyMap.put("240001", "2015050700000011|153");
			categroyMap.put("240002", "2015050700000012|153");
			categroyMap.put("240003", "2015050700000013|153");
			categroyMap.put("240004", "2015050700000014|153");
			categroyMap.put("240005", "2015050700000015|153");
			categroyMap.put("240006", "2015050700000016|153");
			categroyMap.put("240007", "2015050700000017|153");
			categroyMap.put("240008", "2015050700000018|153");
			categroyMap.put("240009", "2015050700000019|153");
			categroyMap.put("240010", "2015050700000020|153");
			categroyMap.put("240011", "2015050700000021|153");
			categroyMap.put("240012", "2015050700000023|153");
			categroyMap.put("240013", "2015050700000024|153");
			categroyMap.put("240014", "2015050700000025|153");
			categroyMap.put("240015", "2015050700000026|153");
			categroyMap.put("240016", "2015050700000027|153");
			categroyMap.put("240017", "2015050700000028|153");
			categroyMap.put("240018", "2015050700000029|153");
			categroyMap.put("240019", "2015050700000030|153");
			categroyMap.put("240020", "2015050700000031|153");
			categroyMap.put("240021", "2015050700000032|153");
			categroyMap.put("240022", "2015050700000034|153");
			categroyMap.put("240023", "2015050700000035|153");
			categroyMap.put("240024", "2015050700000036|153");
			categroyMap.put("240025", "2015050700000040|153");
			categroyMap.put("240026", "2015050700000041|153");
			categroyMap.put("240027", "2015050700000042|153");
			categroyMap.put("240028", "2015050700000043|153");
			categroyMap.put("240029", "2015050700000044|153");
			categroyMap.put("240030", "2015050700000045|153");
			categroyMap.put("240031", "2015050700000046|153");
			categroyMap.put("240032", "2015050700000047|153");
			categroyMap.put("240033", "2015050700000048|153");
			categroyMap.put("240034", "2015050700000049|153");
			categroyMap.put("240035", "2015050700000050|153");
			categroyMap.put("240036", "2015050700000051|153");
			categroyMap.put("240037", "2015050700000052|153");
			categroyMap.put("240038", "2015050700000053|153");
			categroyMap.put("240039", "2015050700000054|153");
			categroyMap.put("240040", "2015050700000055|153");
			categroyMap.put("240041", "2015050700000056|153");
			categroyMap.put("240042", "2015050700000057|153");
			categroyMap.put("240043", "2015050700000058|153");
			categroyMap.put("240044", "2015050700000059|153");
			categroyMap.put("240045", "2015050700000060|153");
			categroyMap.put("240046", "2015050700000061|153");
			categroyMap.put("240047", "2015052200000062|153");
			categroyMap.put("240048", "2015062600011157|153");
			categroyMap.put("240049", "2016031800152626|153");
			categroyMap.put("240050", "2016031800154367|153");
			categroyMap.put("240051", "2016031800154368|153");
			categroyMap.put("240052", "2016031800155597|153");
			categroyMap.put("240053", "2016031800156722|153");
			categroyMap.put("240054", "2016031800158042|153");
			categroyMap.put("240055", "2016031800159500|153");
			categroyMap.put("240056", "2016031800159501|153");
			categroyMap.put("240057", "2016031800160959|153");
			categroyMap.put("240058", "2016031800162476|153");
			categroyMap.put("240059", "2016010600120962|153");
			categroyMap.put("240060", "2015061690000026|153");
			categroyMap.put("240061", "2015061690000027|153");
			categroyMap.put("240062", "2015061690000028|153");
			categroyMap.put("240063", "2015050700000022|153");
			categroyMap.put("240064", "2015050700000033|153");
			categroyMap.put("240065", "2015050700000037|153");
			categroyMap.put("240066", "2015061690000025|153");
			categroyMap.put("240100", "2015050700000038|153");
			categroyMap.put("240101", "2015050700000039|153");
			categroyMap.put("240102", "2015061690000030|153");
			categroyMap.put("2402", "2015112300113179|275");
			categroyMap.put("2403", "2015112300113179|275");
			categroyMap.put("240400", "2016062900190098|9");
			categroyMap.put("240401", "2016062900190099|298");
			categroyMap.put("2405", "2016062900190103|297");
			categroyMap.put("240600", "2015101000064159|148");
			categroyMap.put("240601", "2015101000066113|148");
			categroyMap.put("240602", "2015101000067631|148");
			categroyMap.put("240700", "2016062900190084|297");
			categroyMap.put("240701", "2016062900190085|297");
			categroyMap.put("240800", "2015090700041394|300");
			categroyMap.put("240801", "2016042200000058|149");
			categroyMap.put("2409", "2015090700039570|300");
			categroyMap.put("2410", "2015110500080520|148");
			categroyMap.put("241100", "2016051600178152|148");
			categroyMap.put("241101", "2016051600179925|148");
			categroyMap.put("241102", "2016051600179926|148");
			categroyMap.put("241103", "2016051600181795|148");
			categroyMap.put("241104", "2016051600183429|148");
			categroyMap.put("241105", "2016051600178152|148");
			categroyMap.put("241106", "2016051600178152|148");
			categroyMap.put("241107", "2016012900151604|148");
			categroyMap.put("241108", "2015110500073009|148");
			categroyMap.put("241109", "2015110500074890|148");
			categroyMap.put("241110", "2015110500075901|148");
			categroyMap.put("241111", "2015110500077463|148");
			categroyMap.put("241112", "2015110500077464|148");
			categroyMap.put("241113", "2015110500078657|148");
			categroyMap.put("241114", "2016012900151604|148");
			categroyMap.put("241115", "2015110500078658|148");
			categroyMap.put("241200", "2015091000058486|204");
			categroyMap.put("241201", "2015091000060134|209");
			categroyMap.put("2413", "2016062900190116|210");
			categroyMap.put("2414", "2015062600009243|207");
			categroyMap.put("241500", "2016062900190301|230");
			categroyMap.put("241501", "2016062900190311|230");
			categroyMap.put("241502", "2015063000012448|230");
			categroyMap.put("241503", "2016062900190306|67");
			categroyMap.put("241504", "2016062900190312|176");
			categroyMap.put("241505", "2016062900190304|230");
			categroyMap.put("2416", "2016062900190356|210");
			categroyMap.put("2417", "2016062900190342|210");
			categroyMap.put("3101", "2016062900190247|242");
			categroyMap.put("310200", "2016062900190142|320");
			categroyMap.put("310201", "2016062900190142|320");
			categroyMap.put("310202", "2016062900190142|320");
			categroyMap.put("310203", "2016062900190144|320");
			categroyMap.put("310204", "2016062900190145|320");
			categroyMap.put("3103", "2016062900190248|302");
			categroyMap.put("3104", "2016062900190168|158");
			categroyMap.put("3105", "2016062900190137|320");
			categroyMap.put("310600", "2016063000191709|299");
			categroyMap.put("310601", "2016062900190155|299");
			categroyMap.put("310602", "2016062900190155|320");
			categroyMap.put("3107", "2016062900190155|312");
			categroyMap.put("3108", "2016062900190247|312");
			categroyMap.put("3109", "2016062900190378|167");
			categroyMap.put("3110", "2016062900190378|167");
			categroyMap.put("3111", "2016062900190137|320");
			categroyMap.put("3112", "2016062900190388|281");
			categroyMap.put("3113", "2016062900190218|158");

		}


	}

